package com.cn.book.socketdemo4;

import java.io.IOException;
import java.net.*;

public class ClientDemo {
    public static void main(String[] args) throws IOException {
        DatagramSocket socket = new DatagramSocket();

        String s = "HELLO 组播";
        InetAddress address = InetAddress.getByName("224.0.1.0");//组播地址
        byte[] bytes = s.getBytes();
        int port = 10086;
        DatagramPacket packet = new DatagramPacket(bytes, bytes.length, address, port);
        socket.send(packet);

        socket.close();
    }
}
